#include "FileProcessorElement.h"

#include "../SimpleDockApplication.h"


FileProcessorElement::FileProcessorElement(const String& filePath_, const String& title_, const String& imageUrl) :
DockElement(fileHandler)
{
	filePath = filePath_;
	title = title_;
	imageURL = imageUrl;
}

FileProcessorElement::~FileProcessorElement()
{
	
}

const String FileProcessorElement::getFilePath()
{
	return filePath;
}

void FileProcessorElement::leftMouseButtonClick()
{
	String basePath = File::getCurrentWorkingDirectory().getFullPathName();
	String toFilePath = "/res/" + filePath;
	File f = File(basePath+toFilePath);

	if(!f.isDirectory())
		f.startAsProcess();
	else
		dynamic_cast<SimpleDockApplication*> (JUCEApplication::getInstance())->getMainComponent()->folderVisibilityChanged(this);
}

void FileProcessorElement::rightMouseButtonDown()
{
}

void FileProcessorElement::needsDefaultImage()
{
	DockElement::needsDefaultImage();
}
